

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>cup.res package &mdash; cup 1.7.0 documentation</title>
  

  
  
  
  

  

  
  
    

  

  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="../genindex/" />
    <link rel="search" title="Search" href="../search/" />
    <link rel="next" title="cup.util package" href="../cup.util/" />
    <link rel="prev" title="cup.net.async package" href="../cup.net.async/" /> 

  
  <script src="../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../" class="icon icon-home"> cup
          

          
          </a>

          
            
            
              <div class="version">
                1.7
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../cup/">cup package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../cup/#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../cup.net/">cup.net package</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">cup.res package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-cup.res.linux">cup.res.linux module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-cup.res.mac">cup.res.mac module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-cup.res">Module contents</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../cup.util/">cup.util package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cup.services/">cup.services package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cup.shell/">cup.shell package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cup.storage/">cup.storage package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cup.jenkinslib/">cup.jenkinslib package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cup.web/">cup.web package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.cache">cup.cache module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.const">cup.const module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.decorators">cup.decorators module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.err">cup.err module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.exfile">cup.exfile module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.flag">cup.flag module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.log">cup.log module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.mail">cup.mail module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.platforms">cup.platforms module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.thread">cup.thread module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.timeplus">cup.timeplus module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.unittest">cup.unittest module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup.version">cup.version module</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cup/#module-cup">Module contents</a></li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../">cup</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../">Docs</a> &raquo;</li>
        
          <li><a href="../cup/">cup package</a> &raquo;</li>
        
      <li>cup.res package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/cup.res.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="cup-res-package">
<h1>cup.res package<a class="headerlink" href="#cup-res-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-cup.res.linux">
<span id="cup-res-linux-module"></span><h2>cup.res.linux module<a class="headerlink" href="#module-cup.res.linux" title="Permalink to this headline">¶</a></h2>
<p>Provie Linux Resource/State Info Query</p>
<dl class="function">
<dt id="cup.res.linux.boot_time">
<code class="descclassname">cup.res.linux.</code><code class="descname">boot_time</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#boot_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.boot_time" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the system boot time expressed in seconds since the epoch.</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_boottime_since_epoch">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_boottime_since_epoch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_boottime_since_epoch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_boottime_since_epoch" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">return boot time (seconds) since epoch</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_disk_usage_all">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_disk_usage_all</code><span class="sig-paren">(</span><em>raw=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_disk_usage_all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_disk_usage_all" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>raw</strong> – if raw is True, will use Byte as the measure. Automatically use
MB/GB otherwise.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">return a dict of disk usage</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_disk_info">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_disk_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_disk_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_disk_info" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">get disk info of the system</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="cup.res.linux.CPUInfo">
<em class="property">class </em><code class="descclassname">cup.res.linux.</code><code class="descname">CPUInfo</code><a class="reference internal" href="../_modules/cup/res/linux/#CPUInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.CPUInfo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#cup.res.linux.CPUInfo" title="cup.res.linux.CPUInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">cup.res.linux.CPUInfo</span></code></a></p>
<p>CPUInfo is used for get_cpu_usage function. The following attr will be
in the namedtuple:
usr,
nice,
system,
idle,
iowait,
irq,
softirq,
steal,
guest</p>
<p>I.g.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">cup</span>
<span class="c1"># count cpu usage</span>
<span class="kn">from</span> <span class="nn">cup.res</span> <span class="k">import</span> <span class="n">linux</span>
<span class="n">cpuinfo</span> <span class="o">=</span> <span class="n">linux</span><span class="o">.</span><span class="n">get_cpu_usage</span><span class="p">(</span><span class="n">intvl_in_sec</span><span class="o">=</span><span class="mi">60</span><span class="p">)</span>
<span class="nb">print</span> <span class="n">cpuinfo</span><span class="o">.</span><span class="n">usr</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_cpu_usage">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_cpu_usage</code><span class="sig-paren">(</span><em>intvl_in_sec=1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_cpu_usage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_cpu_usage" title="Permalink to this definition">¶</a></dt>
<dd><p>get cpu usage statistics during a time period (intvl_in_sec), return a
namedtuple CPUInfo</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_cpu_nums">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_cpu_nums</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_cpu_nums"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_cpu_nums" title="Permalink to this definition">¶</a></dt>
<dd><p>get cpu nums</p>
</dd></dl>

<dl class="class">
<dt id="cup.res.linux.MemInfo">
<em class="property">class </em><code class="descclassname">cup.res.linux.</code><code class="descname">MemInfo</code><a class="reference internal" href="../_modules/cup/res/linux/#MemInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.MemInfo" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">cup.res.linux.vmem</span></code></p>
<dl class="docutils">
<dt>get_meminfo will get memory info (a namedtuple returned:</dt>
<dd>total, available, percent, used, free,
active,
inactive,
buffers,
cached)</dd>
</dl>
<p>E.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup.res</span> <span class="k">import</span> <span class="n">linux</span>
<span class="n">meminfo</span> <span class="o">=</span> <span class="n">linux</span><span class="o">.</span><span class="n">get_meminfo</span><span class="p">()</span>
<span class="nb">print</span> <span class="n">meminfo</span><span class="o">.</span><span class="n">total</span>
<span class="nb">print</span> <span class="n">meminfo</span><span class="o">.</span><span class="n">available</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_meminfo">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_meminfo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_meminfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_meminfo" title="Permalink to this definition">¶</a></dt>
<dd><p>get system memory info</p>
</dd></dl>

<dl class="class">
<dt id="cup.res.linux.SWAPINFO">
<em class="property">class </em><code class="descclassname">cup.res.linux.</code><code class="descname">SWAPINFO</code><a class="reference internal" href="../_modules/cup/res/linux/#SWAPINFO"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.SWAPINFO" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">cup.res.linux.SwapInfo</span></code></p>
<p>get_swapinfo will return a SWAPINFO</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_swapinfo">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_swapinfo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_swapinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_swapinfo" title="Permalink to this definition">¶</a></dt>
<dd><p>get swamp info of the system</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.net_io_counters">
<code class="descclassname">cup.res.linux.</code><code class="descname">net_io_counters</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#net_io_counters"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.net_io_counters" title="Permalink to this definition">¶</a></dt>
<dd><p>get network statistics with a list of namedtuple
(bytes_sent, bytes_recv, packets_sent, packets_recv,</p>
<blockquote>
<div>errin, errout, dropin, dropout)</div></blockquote>
<p>example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s1">&#39;lo&#39;</span><span class="p">:</span>
     <span class="p">(</span>
         <span class="mi">235805206817</span><span class="p">,</span> <span class="mi">235805206817</span><span class="p">,</span> <span class="mi">315060887</span><span class="p">,</span> <span class="mi">315060887</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span>
     <span class="p">),</span>
     <span class="s1">&#39;eth1&#39;</span><span class="p">:</span>
     <span class="p">(</span>
         <span class="mi">18508976300272</span><span class="p">,</span> <span class="mi">8079464483699</span><span class="p">,</span> <span class="mi">32776530804</span><span class="p">,</span>
         <span class="mi">32719666038</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">708015</span><span class="p">,</span> <span class="mi">0</span>
     <span class="p">),</span>
     <span class="s1">&#39;eth0&#39;</span><span class="p">:</span>
     <span class="p">(</span>
         <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span>
     <span class="p">)</span>
 <span class="p">}</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_net_through">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_net_through</code><span class="sig-paren">(</span><em>str_interface</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_net_through"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_net_through" title="Permalink to this definition">¶</a></dt>
<dd><p>get network interface statistics by a interface (eth0, e,g,)</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_net_transmit_speed">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_net_transmit_speed</code><span class="sig-paren">(</span><em>str_interface</em>, <em>intvl_in_sec=1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_net_transmit_speed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_net_transmit_speed" title="Permalink to this definition">¶</a></dt>
<dd><p>get network interface write/read speed</p>
<p>E.g.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">cup</span>
<span class="nb">print</span> <span class="n">cup</span><span class="o">.</span><span class="n">res</span><span class="o">.</span><span class="n">linux</span><span class="o">.</span><span class="n">get_net_transmit_speed</span><span class="p">(</span><span class="s1">&#39;eth1&#39;</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.pids">
<code class="descclassname">cup.res.linux.</code><code class="descname">pids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#pids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.pids" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of PIDs currently running on the system.</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.linux.process_iter">
<code class="descclassname">cup.res.linux.</code><code class="descname">process_iter</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#process_iter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.process_iter" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a generator yielding a Process instance for all
running processes.</p>
<p>Every new Process instance is only created once and then cached
into an internal table which is updated every time this is used.</p>
<p>Cached Process instances are checked for identity so that you’re
safe in case a PID has been reused by another process, in which
case the cached instance is updated.</p>
<p>yuetian:
1. the origion use a check_running function to check whether
PID has been reused by another process in which case yield a new
Process instance
hint:i did not use check_running function because the container of
pid is set</p>
<ol class="arabic simple" start="2">
<li><dl class="first docutils">
<dt>the origion use a sorted list(_pmap.items()) +</dt>
<dd>list(dict.fromkeys(new_pids).items()</dd>
</dl>
</li>
</ol>
<p>to get pid and proc to make res.proc is only a instance of a pid Process
hint(bugs):i did not use fromkeys(new_pids) because i did not get the meanning
of using proc</p>
</dd></dl>

<dl class="class">
<dt id="cup.res.linux.Process">
<em class="property">class </em><code class="descclassname">cup.res.linux.</code><code class="descname">Process</code><span class="sig-paren">(</span><em>pid</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Process info query (given a pid)</p>
<dl class="method">
<dt id="cup.res.linux.Process.children">
<code class="descname">children</code><span class="sig-paren">(</span><em>recursive=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.children"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.children" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the children of this process as a list of Process
instances, pre-emptively checking whether PID has been reused.
If recursive is True return all the parent descendants.</p>
<p>Example (A == this process):</p>
<blockquote>
<div><dl class="docutils">
<dt>A ─┐</dt>
<dd>│
├─ B (child) ─┐
│             └─ X (grandchild) ─┐
│                                └─ Y (great grandchild)
├─ C (child)
└─ D (child)</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.create_time">
<code class="descname">create_time</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.create_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.create_time" title="Permalink to this definition">¶</a></dt>
<dd><p>return -1 represent the process does not exists</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_connections">
<code class="descname">get_connections</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_connections"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>get network connection info, each item contains a namedtuple
(fd family type laddr raddr status)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>kind</strong> – kind=’inet’ by default</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a list of network connection info</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_cpu_times">
<code class="descname">get_cpu_times</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_cpu_times"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_cpu_times" title="Permalink to this definition">¶</a></dt>
<dd><p>get cpu times, return with a namedtuple (utime, stime)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_ext_memory_info">
<code class="descname">get_ext_memory_info</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_ext_memory_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_ext_memory_info" title="Permalink to this definition">¶</a></dt>
<dd><p>return namedtuple with FIELDs below:</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cup.res</span> <span class="k">import</span> <span class="n">linux</span>
<span class="n">process</span> <span class="o">=</span> <span class="n">linux</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span>
<span class="nb">print</span> <span class="n">process</span><span class="o">.</span><span class="n">rss</span><span class="p">,</span> <span class="n">process</span><span class="o">.</span><span class="n">dirty</span>
</pre></div>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="14%" />
<col width="65%" />
<col width="11%" />
<col width="11%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">FIELD</th>
<th class="head">DESCRIPTION</th>
<th class="head">AKA</th>
<th class="head">TOP</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>rss</td>
<td>resident set size</td>
<td>/</td>
<td>RES</td>
</tr>
<tr class="row-odd"><td>vms</td>
<td>total program size</td>
<td>size</td>
<td>VIRT</td>
</tr>
<tr class="row-even"><td>shared</td>
<td>shared pages (from shared mappings)</td>
<td>/</td>
<td>SHR</td>
</tr>
<tr class="row-odd"><td>text</td>
<td>text (‘code’)</td>
<td>trs</td>
<td>CODE</td>
</tr>
<tr class="row-even"><td>lib</td>
<td>library (unused in Linux 2.6)</td>
<td>lrs</td>
<td>/</td>
</tr>
<tr class="row-odd"><td>data</td>
<td>data + stack</td>
<td>drs</td>
<td>DATA</td>
</tr>
<tr class="row-even"><td>dirty</td>
<td>dirty pages (unused in Linux 2.6)</td>
<td>dt</td>
<td>/</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_memory_info">
<code class="descname">get_memory_info</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_memory_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_memory_info" title="Permalink to this definition">¶</a></dt>
<dd><p>get memory info, return with a namedtuple (
rss vms shared text lib data dirty)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_memory_maps">
<code class="descname">get_memory_maps</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_memory_maps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_memory_maps" title="Permalink to this definition">¶</a></dt>
<dd><p>get memory map (from /proc smaps file)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_num_ctx_switches">
<code class="descname">get_num_ctx_switches</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_num_ctx_switches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_num_ctx_switches" title="Permalink to this definition">¶</a></dt>
<dd><p>get process context switch info (from /proc status file), return
with a namedtuple (vol, unvol)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_num_fds">
<code class="descname">get_num_fds</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_num_fds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_num_fds" title="Permalink to this definition">¶</a></dt>
<dd><p>get opened file descriptor num</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_open_files">
<code class="descname">get_open_files</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_open_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_open_files" title="Permalink to this definition">¶</a></dt>
<dd><p>get opened file info</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_cmdline">
<code class="descname">get_process_cmdline</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_cmdline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_cmdline" title="Permalink to this definition">¶</a></dt>
<dd><p>get cmdline</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_create_time">
<code class="descname">get_process_create_time</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_create_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_create_time" title="Permalink to this definition">¶</a></dt>
<dd><p>get process create time</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_cwd">
<code class="descname">get_process_cwd</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_cwd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_cwd" title="Permalink to this definition">¶</a></dt>
<dd><p>get process current working direcotry</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_exe">
<code class="descname">get_process_exe</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_exe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_exe" title="Permalink to this definition">¶</a></dt>
<dd><p>get executable info of the process. If the process is a daemon, use
get_process_name instead!</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_gids">
<code class="descname">get_process_gids</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_gids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_gids" title="Permalink to this definition">¶</a></dt>
<dd><p>get process gid, namedtuple will be returned
(with attrs .real .effective .saved)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_io_counters">
<code class="descname">get_process_io_counters</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_io_counters"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_io_counters" title="Permalink to this definition">¶</a></dt>
<dd><p>get io statistics info of network adapters.</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_name">
<code class="descname">get_process_name</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_name" title="Permalink to this definition">¶</a></dt>
<dd><p>get process name of the process (for daemon process only)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_nice">
<code class="descname">get_process_nice</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_nice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_nice" title="Permalink to this definition">¶</a></dt>
<dd><p>get process nice</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_num_threads">
<code class="descname">get_process_num_threads</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_num_threads"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_num_threads" title="Permalink to this definition">¶</a></dt>
<dd><p>get threads num of this process</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_ppid">
<code class="descname">get_process_ppid</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_ppid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_ppid" title="Permalink to this definition">¶</a></dt>
<dd><p>get parent process id</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_status">
<code class="descname">get_process_status</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_status"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_status" title="Permalink to this definition">¶</a></dt>
<dd><p>get status of the current process (info from /proc/xxx/status)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_threads">
<code class="descname">get_process_threads</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_threads"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_threads" title="Permalink to this definition">¶</a></dt>
<dd><p>get threads that is current using, return with a namedtuple (
thread_id, utime, stime)</p>
</dd></dl>

<dl class="method">
<dt id="cup.res.linux.Process.get_process_uids">
<code class="descname">get_process_uids</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#Process.get_process_uids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.Process.get_process_uids" title="Permalink to this definition">¶</a></dt>
<dd><p>get uid info of the process, will return a namedtuple</p>
</dd></dl>

<dl class="attribute">
<dt id="cup.res.linux.Process.nt_mmap_ext">
<code class="descname">nt_mmap_ext</code><a class="headerlink" href="#cup.res.linux.Process.nt_mmap_ext" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">mmap</span></code></p>
</dd></dl>

<dl class="attribute">
<dt id="cup.res.linux.Process.nt_mmap_grouped">
<code class="descname">nt_mmap_grouped</code><a class="headerlink" href="#cup.res.linux.Process.nt_mmap_grouped" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">mmap</span></code></p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="cup.res.linux.get_kernel_version">
<code class="descclassname">cup.res.linux.</code><code class="descname">get_kernel_version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/linux/#get_kernel_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.linux.get_kernel_version" title="Permalink to this definition">¶</a></dt>
<dd><p>get linux kernel verions, e.g.(‘2’, ‘6’, ‘32’):</p>
</dd></dl>

</div>
<div class="section" id="module-cup.res.mac">
<span id="cup-res-mac-module"></span><h2>cup.res.mac module<a class="headerlink" href="#module-cup.res.mac" title="Permalink to this headline">¶</a></h2>
<p>query mac resource module</p>
<dl class="function">
<dt id="cup.res.mac.get_kernel_version">
<code class="descclassname">cup.res.mac.</code><code class="descname">get_kernel_version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/mac/#get_kernel_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.mac.get_kernel_version" title="Permalink to this definition">¶</a></dt>
<dd><p>get kernel info of mac.
e.g.(‘16’, ‘7’, ‘0’):</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.mac.get_cpu_nums">
<code class="descclassname">cup.res.mac.</code><code class="descname">get_cpu_nums</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/mac/#get_cpu_nums"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.mac.get_cpu_nums" title="Permalink to this definition">¶</a></dt>
<dd><p>return cpu num</p>
</dd></dl>

<dl class="function">
<dt id="cup.res.mac.get_disk_usage_all">
<code class="descclassname">cup.res.mac.</code><code class="descname">get_disk_usage_all</code><span class="sig-paren">(</span><em>raw=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/mac/#get_disk_usage_all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.mac.get_disk_usage_all" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>raw</strong> – measure set to Byte if Raw is True</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a py dict: { ‘totalSpace’: xxx, ‘usedSpace’: xxx, ‘freeSpace’: xxx,
‘unit’: xxx
}</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="cup.res.mac.get_disk_info">
<code class="descclassname">cup.res.mac.</code><code class="descname">get_disk_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cup/res/mac/#get_disk_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cup.res.mac.get_disk_info" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">get disk info from the current macOS</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>Exception</strong> – RuntimeError, if got no disk at all</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-cup.res">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-cup.res" title="Permalink to this headline">¶</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">description:</th><td class="field-body">resource related module</td>
</tr>
</tbody>
</table>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../cup.util/" class="btn btn-neutral float-right" title="cup.util package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="../cup.net.async/" class="btn btn-neutral" title="cup.net.async package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2018, CUP-DEV.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../',
            VERSION:'1.7.0',
            LANGUAGE:'en',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="../_static/jquery.js"></script>
      <script type="text/javascript" src="../_static/underscore.js"></script>
      <script type="text/javascript" src="../_static/doctools.js"></script>
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

  

  <script type="text/javascript" src="../_static/js/theme.js"></script>

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>